<div th:fragment="clientForm">

    <p>
        <a class="btn btn-light" data-bs-toggle="collapse" href="#collapseExample" role="button">Add user</a>
    </p>

    <div class="collapse show" id="collapseExample">
        <form th:object="${client}" method="post">
            <tbody>
            <tr>
                <input  type="hidden" name="id" th:value="${client?.id}" />
                <td>
                    <input class="mb-3" type="text" name="name" th:value="${client?.name}" placeholder="name"/>
                </td>
                <td>
                    <input class="mb-3" type="text" name="company" th:value="${client?.company}" placeholder="company"/>
                </td>
                <td>
                    <input class="mb-3" type="text" name="site" th:value="${client?.site}" placeholder="site"/>
                </td>
                <td>
                    <input class="mb-3" type="text" name="phone" th:value="${client?.phone}" placeholder="phone"/>
                </td>
                <td>
                    <input class="mb-3" type="text" name="email" th:value="${client?.email}" placeholder="email"/>
                </td>
                <td th:each="contract: ${contracts}">

                    <div><input th:text="${contract.name}" name="contractSet" class="mb-3" type="checkbox"
                                th:value="${contract.name}"
                                th:checked="${client?.contractSet != null and client.contractSet.contains(contract)}"/>
                    </div>

                </td>
                <input
                        type="hidden"
                        th:name="${_csrf.parameterName}"
                        th:value="${_csrf.token}"/>
                <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
                <td>
                    <button class="badge text-bg-success" type="submit">save</button>
                </td>
                <td>
                    <a href="/clients">clear</a>
                </td>
            </tr>
        </form>
    </div>
</div>